package com.dyb.myrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 改变默认轮询负载策略为随机策略
 * @date 2020-05-02
 */
@Configuration
public class MySelfRule {

    @Bean
    public IRule myRule(){
        //定义为随机负载策略
        return new RandomRule();
    }
}
